Repository navigation
Strip boilerplate and dead code - #1
Merged
Merged
Conversation
…fig format and GUI. Saving is now a single atomic write in FanCurveConfig::save_to_file, shared by the daemon and GUI, replacing the daemon's retry loop and validate_persistence, which re-wrote the live config non-atomically after every save. The daemon's DBus methods share one save and signal path and take their locks in one order (SetFanCurve took them in the opposite order, which could deadlock). The CLI client is a single match over subcommands, main.rs drops its error-boxing map_errs, and fan_detector no longer logs at info level on every control loop tick. Unused error variants, accessors and TempSource::id/from_id are gone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes about 930 lines of boilerplate, defensive code and unused APIs. The CLI commands, DBus methods and signals, config file format, GUI layout, fan curve math and the Thelio Io control loop are unchanged.
Removed
FanCurveConfig::validate_persistenceand the daemon's 3x save retry loop. Validation re-wrote the live config non-atomically after every save.zbus_error_from_displayand five unused error variants (FanCurveNotFound,InvalidFanPoint,PermissionDenied,DaemonNotRunning,Unknown).FanCurve::save_to_file/load_from_file,points_mut,get_point,FanDetector::read_fan_speed/fan_count,TempSource::id/from_id, and thenvidia_temperatureswrapper.fan_detector's info-level logging on every control loop tick, plus the startup checks that only logged.Simplified
FanCurveConfig::save_to_filecreates the config directory, writes a temp file and renames it. The daemon and GUI both use it instead of their own copies.save(),curve_index()andemit_curve_changed(). The built-in read-only checks are unchanged.client::run(command)match.main.rshandles every subcommand in one match without boxing errors by hand.cpu_tempandfan_detectorkeep the same detection logic in far less code.duty_for_temperatureinterpolates overwindows(2)and gives the same results.Behavior changes
SetFanCurvetook the config and curve index locks in the opposite order from every other method, which could deadlock. All methods now take them in the same order.fan-curve-appwith no subcommand prints "No command specified" without the "Unknown error:" prefix./proc/cpuinfohas novendor_idline, CPU temperature detection tries both coretemp and k10temp instead of failing.Testing
cargo clippy --all-targets -- -D warningsis clean, andcargo testpasses 47 tests, including theprofilesandcrash_recoveryintegration tests. Two unit tests were removed with the code they covered.